Support custom upgrade for custom repo in WLED - #172914
Closed
mik-laj wants to merge 1 commit into
Closed
Conversation
Contributor
|
Hey there @frenck, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds per-device repository support for WLED firmware updates, so that devices using custom WLED forks receive the correct release information and upgrade paths.
Changes:
- The releases coordinator now tracks multiple repos (one per config entry) and fetches releases for each distinct repo.
- The update entity registers/unregisters its repo with the releases coordinator and uses repo-specific release info and release URLs.
- The
wleddependency is temporarily changed to a git branch.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
homeassistant/components/wled/coordinator.py |
Refactors WLEDReleasesDataUpdateCoordinator to manage a dict of per-repo releases instead of a single Releases object. |
homeassistant/components/wled/update.py |
Adds repo registration lifecycle, overrides _handle_coordinator_update, and uses per-repo release info/URLs. |
homeassistant/components/wled/manifest.json |
Changes wled package requirement to a git branch URL. |
Comment on lines
+10
to
+12
| "requirements": [ | ||
| "wled @ git+https://github.com/LordMike/python-wled@codex/use-device-repo-upgrade" | ||
| ], |
Comment on lines
+202
to
+203
| if self.repos.get(entry_id) != repo: | ||
| self.repos[entry_id] = repo.lower() |
|
|
||
| def unregister_repo(self, entry_id: str) -> None: | ||
| """Unregister a repo.""" | ||
| del self.repos[entry_id] |
Comment on lines
+212
to
+219
| result = {} | ||
| repos = set(self.repos.values()) | ||
| for repo in repos: | ||
| try: | ||
| update = await WLEDReleases( | ||
| repo=repo, | ||
| session=async_get_clientsession(self.hass), | ||
| ).releases() |
Comment on lines
+72
to
+81
| @callback | ||
| def _handle_coordinator_update(self) -> None: | ||
| """Handle updated data from the coordinator.""" | ||
| self.hass.async_create_task( | ||
| self.releases_coordinator.register_repo( | ||
| entry_id=self.coordinator.config_entry.entry_id, | ||
| repo=self._repo, | ||
| ) | ||
| ) | ||
| super()._handle_coordinator_update() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
Proposed change
Alternative PR for: #172481
Related to: frenck/python-wled#2078 (Add the
repofield in theInfoobject and therepoparameter in the.upgrademethod)I'm opening a PR here to show how we can implement support for updating multiple repositories in a single coordinator. This is still a draft, but I want to show my idea. If we agree on the implementation, we can close this PR and continue with the previous one.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: